//
//  CatDemoViewController.m
//  Runner
//
//  Created by 张超 on 2021/2/25.
//

#import "CatDemoViewController.h"

@interface CatDemoViewController ()

@end

@implementation CatDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"nativeView";
    //    方案一,未能改变标题栏高度
    if ([self.params[@"color"] isEqualToString:@"绿色"]) {
        
        [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:21/255.0 green:149/255.0 blue:136/255.0 alpha:1.0]];
        
        [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
        [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor],NSFontAttributeName : [UIFont boldSystemFontOfSize:17]}];
    };
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@" " style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem = item;
    
    CGFloat statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
    NSLog(@"状态栏高度:%f",statusHeight);
    
    //获取导航栏的高度
    CGFloat navHeight = self.navigationController.navigationBar.frame.size.height;
    NSLog(@"导航栏高度:%f",navHeight);
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //    //界面显示打开bar
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    
    [self.navigationController.navigationBar setFrame:CGRectMake(0,0,[UIScreen mainScreen].bounds.size.width,112)];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear: animated];
    //    //界面显示关闭bar
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    //
}

@end
